class LoginController < ApplicationController
	layout "admin"

	def add_user
		@user = User.new(params[:user])
		if request.post? and @user.save
			flash[:notice] = "User #{@user.name} created"
			@user = User.new
		end
	end

	def login
		session[:user_id] = nil
		if request.post?
			user = User.authenticate(params[:name], params[:password])
			if user
				session[:user_id] = user.id
				redirect_to(:action => "index")
			else
				flash[:notice] = "Invalid usr/password"
			end
		end
	end

	def logout
	end

	def index
	end

	def delete_user
	end

	def list_users
	end

end
